import { FormProps, FormSchema } from '@/components/Table'
import { BasicColumn } from '@/components/Table/src/types/table'

// 商品列表
export function getGoodsBasicColumns(): BasicColumn[] {
  return [
    {
      title: '商品名称',
      width: 180,
      customEllipsis: true,
      dataIndex: 'goodsName'
    },
    {
      title: '描述',
      customEllipsis: true,
      dataIndex: 'goodsDesc'
    },
    {
      title: '所属套餐',
      dataIndex: 'packageNameSet'
    },
    {
      title: '创建时间',
      width: 160,
      dataIndex: 'createTime'
    },
    {
      title: '操作',
      width: 96,
      dataIndex: 'operate'
    }
  ]
}

export function getSearchFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 80,
    baseColProps: {
      span: 6,
      md: 10,
      xl: 8,
      xxl: 6
    },
    schemas: [
      {
        field: 'goodsName',
        label: '商品名称',
        component: 'Input'
      }
    ]
  }
}

// 商品信息表单
export function getGoodsFormConfig(): Partial<FormProps> {
  return {
    showActionButtonGroup: false,
    labelWidth: 120,
    baseColProps: {
      span: 20,
      style: {
        marginBottom: '4px'
      }
    },
    schemas: [
      {
        field: 'goodsName',
        component: 'Input',
        label: '商品名称',
        required: true,
        componentProps: {
          maxLength: 20
        }
      },
      {
        field: 'goodsDesc',
        component: 'InputTextArea',
        label: '商品描述',
        componentProps: {
          autoSize: { minRows: 3, maxRows: 3 },
          maxLength: 100,
          placeholder: '请输入商品描述，100字以内'
        }
      }
    ]
  }
}
